package com.powerflasher.as3potrace.geom
{
   public class MonotonInterval
   {
       
      
      public var increasing:Boolean;
      
      public var from:int;
      
      public var to:int;
      
      public var currentId:int;
      
      public function MonotonInterval(param1:Boolean, param2:int, param3:int)
      {
         super();
         this.increasing = param1;
         this.from = param2;
         this.to = param3;
      }
      
      public function resetCurrentId(param1:int) : void
      {
         if(!this.increasing)
         {
            this.currentId = this.mod(this.min() + 1,param1);
         }
         else
         {
            this.currentId = this.min();
         }
      }
      
      public function min() : int
      {
         return !!this.increasing?int(this.from):int(this.to);
      }
      
      public function max() : int
      {
         return !!this.increasing?int(this.to):int(this.from);
      }
      
      public function minY(param1:Vector.<PointInt>) : int
      {
         return param1[this.min()].y;
      }
      
      public function maxY(param1:Vector.<PointInt>) : int
      {
         return param1[this.max()].y;
      }
      
      private function mod(param1:int, param2:int) : int
      {
         return param1 >= param2?int(param1 % param2):param1 >= 0?int(param1):int(param2 - 1 - (-1 - param1) % param2);
      }
   }
}
